* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #f5f7fa;
    --dark-text: #2c3e50;
    --light-text: #ecf0f1;
    --border-color: #e0e6ed;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body {
    background-color: var(--light-bg);
    color: var(--dark-text);
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    box-shadow: var(--card-shadow);
}

/* 左侧导航 */
.sidebar {
    width: 220px;
    background-color: var(--secondary-color);
    color: var(--light-text);
    padding: 20px 0;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

.logo {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.logo h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--primary-color);
}

.categories h2 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 20px;
    margin-bottom: 15px;
    color: rgba(255, 255, 255, 0.6);
}

.category-list {
    list-style: none;
}

.category-item {
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.category-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.category-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary-color);
}

.category-item i {
    width: 20px;
    text-align: center;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 顶部搜索栏 */
.search-bar {
    padding: 15px 20px;
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.search-container {
    flex: 1;
    position: relative;
}

.search-container i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #95a5a6;
}

.search-input {
    width: 100%;
    padding: 10px 15px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.add-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.add-btn:hover {
    background-color: #2980b9;
}

/* Payload列表 */
.payload-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

.payload-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.payload-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--card-shadow);
}

.payload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.payload-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.payload-category {
    background-color: var(--primary-color);
    color: white;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.payload-content {
    background-color: var(--light-bg);
    font-family: 'Consolas', 'Courier New', monospace;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    margin: 10px 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.payload-tags {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.tag {
    background-color: #e0f0ff;
    color: var(--primary-color);
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
}

.payload-actions {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.payload-item:hover .payload-actions {
    opacity: 1;
}

.action-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #95a5a6;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #bdc3c7;
}

/* 提示信息 */
.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--secondary-color);
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

.notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .category-list {
        display: flex;
        overflow-x: auto;
        padding-bottom: 10px;
    }

    .category-item {
        padding: 10px 15px;
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
    }

    .category-item.active {
        border-left: none;
        border-bottom-color: var(--primary-color);
    }
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #95a5a6;
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.form-textarea {
    width: 100%;
    height: 150px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.95rem;
    resize: vertical;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.form-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.tag-input {
    flex: 1;
    min-width: 100px;
}

.tag-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #e0e6ed;
    color: var(--dark-text);
    border: none;
}

.btn-secondary:hover {
    background-color: #d0d6dd;
}

.loading {
    text-align: center;
    padding: 50px 20px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(52, 152, 219, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 新增分类管理相关样式 */
.category-manage {
    padding: 15px 20px 0;
    margin-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.manage-categories-btn {
    width: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--light-text);
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: all 0.2s;
}

.manage-categories-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.category-item-count {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

.editable-category-list {
    list-style: none;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.editable-category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: var(--light-bg);
    border-radius: 6px;
    margin-bottom: 10px;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.category-name-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.category-name-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.category-actions {
    margin-left: 10px;
}

.delete-category-btn {
    padding: 6px 10px;
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-category-btn:hover {
    background-color: #ff5252;
}

.add-category-form {
    background-color: var(--light-bg);
    padding: 15px;
    border-radius: 8px;
}

.add-category-form h4 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.external-badge {
    background-color: #f39c12;
    color: white;
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 8px;
}